<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="s" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="security"
	uri="http://www.springframework.org/security/tags"%>
<section class="content-header">
	<h1>
		我的房屋信息 <small>查看所有住房情况</small>
	</h1>
	<ol class="breadcrumb">
		<li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
		<li><a href="#">房屋管理</a></li>
		<li class="active">我的房屋管理</li>
	</ol>
</section>
<section class="content">
	<div class="bjui-pageHeader">
		<div class="col-md-12">
			<form action="<c:url value="/housing/index"/>" method="post"
				data-toggle="ajaxsearch">
				<security:csrfInput />
				<select name="buildingId">
					<c:forEach items="${buildings }" var="obj">
						<option value="${obj.id }">${obj.name }</option>
					</c:forEach>
				</select>
				<button type="submit" class="btn btn-default">查询</button>
			</form>
		</div>
	</div>
	<div>

		<div class="row" style="margin-top: 20px;">
			<c:forEach items="${housings }" var="obj">
				<div class="col-md-3 col-sm-4 col-xs-4">
					<div class="panel panel-default">
						<div class="panel-body">
							<p>
								房号：<span>${obj.number }</span>
							</p>
							<p>
								租客：<span>${obj.tenant.username }</span>
							</p>
							<p>
								联系电话：<span>${obj.tenant.phone }</span>
							</p>
							<p>
								状态：
								<samp>${obj.status }</samp>
							</p>
							<div align="right">
								<c:url value="/housing/details" var="editUrl">
									<c:param name="id" value="${obj.id }" />
								</c:url>
								<c:if test="${!obj.status }">
									<a href="<s:url value="/housing/toCheckIn/{id}"><s:param name="id" value="${obj.id }"/></s:url>" class="btn btn-primary">入住</a>
								</c:if>
								<c:if test="${obj.status }">
									<a href="<s:url value="/housing/dsadsa"/>" class="btn btn-default">退房</a>
								</c:if>
								<button type="button" class="btn btn-default">删除</button>
								<a href="<s:url value="/housing/details/{id}"><s:param name="id" value="${obj.id }"/></s:url>" class="btn btn-default" >详情</a>
							</div>
						</div>
					</div>
				</div>
			</c:forEach>
		</div>
	</div>
</section>